package com.redis.springbootredis.controller;


import com.redis.springbootredis.config.spring.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisSentinelPool;

/**
 * xufan
 * 2019/1/1
 */

@RestController
public class MyRedisTest {


    @Autowired
    private RedisUtil redisUtil;

    @Autowired
    JedisSentinelPool pool;


    @RequestMapping("/test")
    public Object getRedisValue(){
        String result = "fhskdjfhksj";
        String a = redisUtil.get("xufan").toString();
        redisUtil.set("test","dsfds");
        return  result+"----"+a ;
    }


    @RequestMapping("/oldtest")
    public Object oldtest(){
       Jedis jedis =  pool.getResource();
       String result = jedis.get("xufan");
        jedis.set("xufan","123");
        return  result+"----";
    }
}
